package com.ruoyi.project.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.base.Field;
import com.ruoyi.project.service.impl.CostMatchDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;

import javax.validation.constraints.DecimalMax;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("出库销售表")
@TableName("project_sale")
public class ProjectSale extends Field {
    /** 表id */
    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(fill = FieldFill.INSERT)
    private Long id;

    /** 货物id */
    private String goodsId;

    /** 出库日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd")
    //出库日期
    private Date saleDate;

    @Excel(name = "出库数量",isStatistics = true)
    //出库数量
    private Integer amount;

    @TableField(exist = false)
    @Excel(name = "成本单价")
    //成本单价
    private String costString;

    //成本合计
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @Excel(name = "成本合计",isStatistics = true)
    //成本合计
    private BigDecimal costTotal;

    /** 单价 */
    @Excel(name = "销售售价")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    //销售单价
    private BigDecimal price;

    //销售总金额
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @Excel(name = "销售总金额",isStatistics = true)
    //销售总金额
    private BigDecimal total;

    //毛利 销售总金额减去成本合计
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @Excel(name = "毛利",isStatistics = true)
    private BigDecimal profit;

    //毛利率 销售总金额减去成本合计除以销售总金额乘以100%
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @TableField(exist = false)
    @Excel(name = "毛利率%")
    private BigDecimal profitRatio;


    /** 完整名称 */
    @TableField(exist = false)
    @Excel(name = "设备全称")
    private String fullName;

    /** 简称 */
    @TableField(exist = false)
    @Excel(name = "设备简称")
    private String name;


    /** 型号 */
    @TableField(exist = false)
    @Excel(name = "设备型号")
    private String modal;


    /** 参数 */
    @TableField(exist = false)
    @Excel(name = "设备参数")
    private String param;


    //管家婆项目id
    private String housekeeperProject;

    //成本单价
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal costPrice;




    //管家婆项目名称拼接
    @TableField(exist = false)
    private String companyName;

    //设备名称型号参数拼接
    @TableField(exist = false)
    private String goodsAllName;


    @TableField(exist = false)
    private List<CostMatchDetail> matchDetails;

    //该条数据对应的是哪个数据库的
    private String datas;


    @TableField(exist = false)
    private String status = "0";

    //发票的code
    private String code;

    private String orders;

    //开票金额
    private BigDecimal invoiceAmount ;

    @TableField(exist = false)
    private List<BigDecimal> costList;

    @TableField(exist = false)
    private BigDecimal oldCostPrice;


    @TableField(exist = false)
    private List<ProjectSaleLog> logList;


}
